package com.hcbd.tdwt.util;

import com.hcbd.tdwt.ui.haige.common.vo.SecurityContentVO;
import com.raizlabs.android.dbflow.annotation.Database;
import com.raizlabs.android.dbflow.annotation.Migration;
import com.raizlabs.android.dbflow.sql.SQLiteType;
import com.raizlabs.android.dbflow.sql.migration.AlterTableMigration;
import com.hcbd.tdwt.ui.xingyu.vo.BoxContact;

@Database(name = AppDatabase.NAME, version = AppDatabase.VERSION)
public final class AppDatabase {
    //数据库名称
    public static final String NAME = "monitoringDB";
    //数据库版本号
    public static final int VERSION = 4;

    @Migration(version = VERSION, database = AppDatabase.class)//=2的升级
    public static class Migration1 extends AlterTableMigration<BoxContact> {
        public Migration1(Class<BoxContact> table) {
            super(table);
        }
        @Override
        public void onPreMigrate() {
            addColumn(SQLiteType.TEXT, "sortLetter");
        }
    }
    @Migration(version = VERSION, database = AppDatabase.class)//=2的升级
    public static class Migration2 extends AlterTableMigration<SecurityContentVO> {
        public Migration2(Class<SecurityContentVO> table) {
            super(table);
        }
        @Override
        public void onPreMigrate() {
            addColumn(SQLiteType.get(boolean.class.getName()), "isSelect");
        }
    }
}
